var a = getApp();

Page({
    data: {
        activeName: 0,
        page: 1,
        searchText: ""
    },
    onLoad: function(a) {
        this.getData();
    },
    goOrder: function() {
        wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0"
        });
    },
    tapTabs: function(a) {
        var t = a.detail.index;
        this.setData({
            activeName: t,
            page: 1
        }), this.getData();
    },
    goDetail: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageH/blindBox/blindBoxDetail/blindBoxDetail?id=" + t
        });
    },
    tapSlide: function(a) {
        var t = a.currentTarget.dataset.mini_url;
        wx.navigateTo({
            url: t
        });
    },
    textInp: function(a) {
        console.log(a);
        var t = a.detail.value;
        this.setData({
            searchText: t
        });
    },
    goSearch: function() {
        this.setData({
            page: 1
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (this.data.current_page >= this.data.last_page) console.log("没有更多了"); else {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.getMoreData();
        }
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t;
        wx.showLoading({
            title: "加载中"
        }), t = this.data.activeName ? {
            activity_type: this.data.activeName,
            page: this.data.page
        } : {
            activity_type: "",
            page: this.data.page
        }, "" != this.data.searchText && (t.search = this.data.searchText);
        var e = this, i = a.getNetAddresss("plugin.blind-box.api.index.activity");
        a._postNetWork({
            url: i,
            data: t,
            success: function(a) {
                var t = a.data;
                wx.hideLoading({
                    success: function(a) {}
                }), 1 == t.result ? e.setData({
                    list: t.data.list.data,
                    slide: t.data.slide,
                    current_page: t.data.list.current_page,
                    last_page: t.data.list.last_page
                }) : console.log(t);
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    getMoreData: function() {
        var t;
        wx.showLoading({
            title: "加载中"
        }), t = this.data.activeName ? {
            activity_type: this.data.activeName,
            page: this.data.page
        } : {
            activity_type: "",
            page: this.data.page
        }, "" != this.data.searchText && (t.search = this.data.searchText);
        var e = this, i = a.getNetAddresss("plugin.blind-box.api.index.activity");
        a._postNetWork({
            url: i,
            data: t,
            success: function(a) {
                var t = a.data;
                wx.hideLoading({
                    success: function(a) {}
                }), 1 == t.result ? e.setData({
                    list: t.data.list.data,
                    current_page: t.data.list.current_page,
                    last_page: t.data.list.last_page
                }) : console.log(t);
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    }
});